from pylab import *
from PyQt4.Qt import *
import matplotlib as mpl
import numpy as np

#d1 = ones(1000)
#d2 = zeros(1000)
#d3 = zeros(1000)
#d4 = zeros(1000)

class Algo:
    def __init__(self, dx=10, dy=10, s1=None, s2=None, s3=None, s4=None):
        self.dx = dx
        self.dy = dy
        self.kk1 = s1
        self.kk2 = s2
        self.kk3 = s3
        self.kk4 = s4
        self.rozmer = dx*dy
        
    def Vypocet(self):
        x = arange(1, self.dx+1, 1)
        y = arange(1, self.dy+1, 1)
        yy = y.reshape(self.dy, 1)
        S1 = ((self.dx-x)*(self.dy-yy))
        S1 = S1.reshape(S1.size, 1)
        S2 = x*(self.dy-yy)
        S2 = S2.reshape(S2.size, 1)
        S3 = x*yy
        S3 = S3.reshape(S3.size, 1)
        S4 = (self.dx-x)*yy
        S4 = S4.reshape(S4.size, 1)
        
    
        B1 = self.kk1 * S1
        B1 = B1.reshape(B1.size, 1)
        B2 = self.kk2 * S2
        B2 = B2.reshape(B2.size, 1)
        B3 = self.kk3 * S3
        B3 = B3.reshape(B3.size, 1)
        B4 = self.kk4 * S4
        B4 = B4.reshape(B4.size, 1)
        Bxy = (B1 + B2 + B3 + B4)/self.rozmer
        
        self.B = resize(Bxy, (self.rozmer, 1000))
        return self.B


  
    


#vyp = Algo(10, 10, d1, d2, d3, d4)

#print vyp.Vypocet()

#B = vyp.Vypocet()
#print ndim(B)

#for i in range(0, 1):
  #      obr = resize(B[:,i], (10, 10))
    #    im = imshow(obr,  interpolation='bicubic', animated=True)
       # im.set_data(obr)
#show()
